package com.infocollect.project.api.ui;


import com.infocollect.project.api.entity.TappProcessChartEntity;
import com.infocollect.project.api.service.ITappProcessChartService;
import com.infocollect.project.form.vo.R;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * (TappProcesschart)表控制层
 *
 * @author makejava
 * @since 2019-12-25 10:32:30
 */
@Api(value = "tappProcesschart", tags = "流程设计图形信息")
@RestController
@RequestMapping("tappProcesschart")
public class TappProcesschartController {
    /**
     * 服务对象
     */
    @Resource
    private ITappProcessChartService tappProcesschartService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @PostMapping("selectOne/{id}")
    @ResponseBody
    public R<TappProcessChartEntity> selectOne(@PathVariable(name = "id") Long id) throws IOException{
        return R.newOk( this.tappProcesschartService.queryById(id)) ;
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @PostMapping("queryByProcessId/{id}")
    @ResponseBody
    public R<TappProcessChartEntity> queryByProcessId(@PathVariable(name = "id") Long id) throws IOException{
        TappProcessChartEntity tappProcessChartEntity=   this.tappProcesschartService.queryByProcessId(id);
        if(tappProcessChartEntity==null){
              return R.newError("找不到流程配置信息！可能已被删除！");
        }else {
            return R.newOk(tappProcessChartEntity);
        }
    }

}
